package com.photoeditor.demo.model.subscribe.strategy;

import com.common.commercialize.strategy.StrategyManager;
import com.photoeditor.demo.ad.CameraStrategyConstant;
import com.photoeditor.demo.app.TestUser;
import com.photoeditor.demo.model.preference.SPDataManager;

public class OneFreeStrategyManager {

    public final static int RATE_OBTAIN_ONE_DAY_VIP = 2;
    public final static int ADVANCE_OBTAIN_RESULT = 1;
    public final static int ORIGINAL_RATE_GUIDE = 0;

    public static RateNewStrategyBean.RateNewStrategyBeanConfig getOneFreeVipOrAdStrategyConfig() {
        RateNewStrategyBean.RateNewStrategyBeanConfig strategyFirstConfig = StrategyManager.getInstance().getStrategyFirstConfig(CameraStrategyConstant.FUN_ID_RATE_DIALOG, RateNewStrategyBean.class);
        if (strategyFirstConfig == null && TestUser.isTestUser()) {
            strategyFirstConfig = new RateNewStrategyBean.RateNewStrategyBeanConfig();
            strategyFirstConfig.setRateType(ADVANCE_OBTAIN_RESULT);
        }

        int showTime = SPDataManager.getSubscribeActivityShowTime();
        if (strategyFirstConfig != null && showTime < strategyFirstConfig.getCloseTime()) {
            //次数不足，不展示
            return null;
        }
        return strategyFirstConfig;
    }
}
